//
//  TransparencyLayer.m
//  QuartzStudy
//
//  Created by longhuihu on 11-6-22.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "TransparencyLayer.h"


@implementation TransparencyLayer

-(void)drawRect:(CGRect)rect
{
	[super drawRect:rect];
	
	CGContextRef myContext = UIGraphicsGetCurrentContext();
	
	
	CGContextSetRGBFillColor (myContext, 1, 1, 1, 1);
	CGContextFillRect(myContext, self.bounds);
	
	CGSize          myShadowOffset = CGSizeMake (10, -20);// 2
	CGContextSetShadow (myContext, myShadowOffset, 10);   // 3
    CGContextBeginTransparencyLayer (myContext, NULL);// 4
	
	CGFloat wd = 100;
	CGFloat ht = 100;
	
    // Your drawing code here// 5
    CGContextSetRGBFillColor (myContext, 0, 0, 1, 1);
    CGContextFillEllipseInRect (myContext, CGRectMake (50,50,wd,ht));
    CGContextSetRGBFillColor (myContext, 1, 0, 0, 1);
    CGContextFillEllipseInRect (myContext, CGRectMake (50,150,wd,ht));
	CGContextSetRGBFillColor (myContext, 0, 1, 0, 1);
    CGContextFillEllipseInRect(myContext, CGRectMake (100,100,wd,ht));
    CGContextEndTransparencyLayer (myContext);
}


@end
